<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderPrePaysTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_pre_pays', function (Blueprint $table) {
            $table->id();

            $table->decimal('cost_total',10,2)->default(0.00)->comment('自选和附加服务总价');
            $table->decimal('cost_diff',10,2)->default(0.00)->comment('自选和附加服务差价');

            $table->decimal('break_rules',10,2)->default(0.00)->comment('违章押金支付金额');
            $table->integer('break_rules_status')->default(0)->comment('违章押金状态');

            $table->decimal('deposit',10,2)->default(0.00)->comment('车辆押金支付金额');
            $table->integer('deposit_status')->default(0)->comment('车辆押金状态');
            
            $table->decimal('pay_back',10,2)->default(0.00)->comment('补缴预付金额');
            $table->string('order_sn')->default('')->comment('订单编号');
            $table->timestamps();
        });
        \DB::statement("ALTER TABLE `order_pre_pays` comment '线下变更预付信息'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_pre_pays');
    }
}
